# name : proc lifetest for rmst, rmtl, restricted mean survival time
# key : lifetest.rmst.rmtl.
# key : rmst.rmtl.lifetest
# contributor: Shuguang Sun
# --
ods select rmstinfo rmst rmsttest rmstdiff;
ods ouptut rmst=rmst_${91:est} rmsttest=rmst_${92:test} rmstdiff=rmst_{$93:diff};
proc lifetest data = ${1:dtin} notable
rmst(tau=${2:tau}) rmtl plots = (rmst rmtl survival(test));
time aval * cnsr (0);
strata ${3:trt01pn} / diff=control("${4:2}");
run;

data rmst_$93;
  set rmst_$93;
  lcl = estimate - squantile('normal', 0.025) * stderr;
  ucl = estimate + squantile('normal', 0.025) * stderr;
run;